from dataclasses import dataclass

from src.application.user import dto
from src.application.user.uow import UserUoW


@dataclass(frozen=True)
class GetUserById:
    user_id: int


class GetUserByIdHandler:
    def __init__(self, *, uow: UserUoW) -> None:
        self._uow = uow

    async def __call__(self, command: GetUserById) -> dto.UserDTO:
        user = await self._uow.user_reader.get_user_by_id(user_id=command.user_id)

        return user
